{:W('Template/top')}
<div class="wrapper clearfix content" style="position: relative;border: 1px solid #ddd">
    {:W('Template/left')}
    <div class="rightbox pull-right">
        <div class="ur-here">您当前的位置：<a href="#">账户调整管理</a>&gt;账户调整添加</div>
        <div class="cTitle2">账户调整添加</div>
        <div class="main-search">
            <div class="top clearfix">
                <form method="post" action="{:U('Refund/add',array('id'=>I('get.id')))}" class="form-inline">
                    <div class="btn-group">
                        <select name='account_type' class='account_type'
                                style='height:33px;width:105px;border:1px solid #ddd;'>
                            <option value='1'>&nbsp;&nbsp;-----类型-----</option>
                            <option value='4'>&nbsp;&nbsp;代理商</option>
                            <option value='3'>&nbsp;&nbsp;供应商</option>
                            <if condition="$Think.session.role_id eq 1">
                                <option value='2'>&nbsp;&nbsp;运营商账户余额</option>
                                <option value='5'>&nbsp;&nbsp;运营商授信余额</option>
                                <option value='6'>&nbsp;&nbsp;平台商机票</option>
                            </if>
                        </select>
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control name" name='name' placeholder="请输入姓名"
                               style='margin-left: 10px;'/>
                    </div>
                    <button type="submit" class="btn btn-warning">查询</button>
                </form>
            </div>
        </div>

        <form method="post" action="">
            <input type='hidden' id='code' value='{$Think.session.refundCode}'>
            <input id="account_type" type="hidden" value="{$account_type}"/>
            <input id="refundList" type="hidden" value="{:U('OperatorFinance/lists',array('id' => 99))}"/>
            <input id="saveRefundAdd" type="hidden" value="{:U('Refund/saveRefund')}"/>
            <table class="cTable table-hover" width="100%">
                <tr>
                    <th>名称</th>
                    <th>合约起止</th>
                    <th>账户总额</th>
                    <th>账户</th>
                    <th>状态</th>
                    <th width="12%">操作</th>
                </tr>
                <volist name='info' id='v'>
                    <td>
                        <if condition="$v['istest'] eq 1">
                            <span class='text-c1'>{$v.name}</span>
                            <else/>
                            {$v.name}
                        </if>
                    </td>

                    <td>{$v.contract_start_time|substr=0,10}<br/>{$v.contract_end_time|substr=0,10}</td>
                    <td id="money-right" class="text-c5">
                        <if condition="($account_type eq '5') or ($account_type eq '6')">
                            {$v.account_credit_balance|GetYuan}
                            <else/>
                            {$v.account_balance|GetYuan}
                        </if>
                    </td>
                    <td>
                        <if condition="$v.account_state eq 1">
                            <span class="text-c7">正常</span>
                            <elseif condition="$v.account_state eq 2"/>
                            <span class="text-c8">冻结</span>
                        </if>
                    </td>
                    <td>
                        <if condition="$v.state eq 1">
                            <span class="text-c7">正常</span>
                            <elseif condition="$v.state eq 2"/>
                            <span class="text-c8">禁用</span>
                        </if>
                    </td>
                    <td>
                        <div class="btn-group">
                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                    aria-expanded="false">
                                操作<span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" role="menu">
                                <li><a href="javascript:void(0)" onclick="addRefund({$v.id})">变动</a></li>
                            </ul>
                        </div>
                    </td>
                    </tr>
                </volist>
            </table>
        </form>
        <notempty name="info">
            <div class="pagebox">
                {$page}
            </div>
        </notempty>
    </div>
</div>

<div class="modal fade" id="myModalLabel" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:300px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    账户手动调整添加
                </h4>
            </div>
            <div class="modal-body">
                金额：
                <input type="text" class="form-control" id="amount">
                凭证：
                <input type="text" class="form-control" id="proof">
                备注：
                <input type="text" class="form-control" id="memo">
            </div>
            <div class="modal-footer">
                <div class="pull-right">
                    <button type="button" class="btn btn-primary" id="saveRefund">
                        提交
                    </button>
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
{:W('Template/bottom')}

<script>
    $("form").submit(function (event) {
        if ($(".account_type").val() == 1) {
            jalert('未选择类型', function () {
            });
            return false;
        }

        if (!$(".name").val()) {
            jalert('请输入姓名', function () {
            });
            return false;
        }
    });
</script>
</body>
</html>